/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.interpreter.impl;

import xowl.interpreter.QuerySolution;
import java.util.List;
import xowl.interpreter.XOWLException;

/**
 *
 * @author Laurent WOUTERS
 */
public interface Evaluator {
    boolean can(xowl.lang.owl2.Expression exp);
    boolean can(xowl.lang.actions.Query exp);
    
    xowl.lang.runtime.Value evaluate(Evaluator top, xowl.lang.owl2.Expression expression) throws XOWLException;
    xowl.lang.runtime.Entity evalEntity(Evaluator top, xowl.lang.owl2.EntityExpression expression) throws XOWLException;
    xowl.lang.runtime.Class evalClass(Evaluator top, xowl.lang.owl2.ClassExpression expression) throws XOWLException;
    xowl.lang.runtime.ObjectProperty evalObjProp(Evaluator top, xowl.lang.owl2.ObjectPropertyExpression expression) throws XOWLException;
    xowl.lang.runtime.DataProperty evalDataProp(Evaluator top, xowl.lang.owl2.DataPropertyExpression expression) throws XOWLException;
    xowl.lang.runtime.Datatype evalDatatype(Evaluator top, xowl.lang.owl2.Datarange expression) throws XOWLException;
    xowl.lang.runtime.Individual evalIndividual(Evaluator top, xowl.lang.owl2.IndividualExpression expression) throws XOWLException;
    xowl.lang.runtime.Literal evalLiteral(Evaluator top, xowl.lang.owl2.LiteralExpression expression) throws XOWLException;
    xowl.lang.runtime.Function evalFunction(Evaluator top, xowl.lang.actions.FunctionExpression expression) throws XOWLException;
    xowl.lang.runtime.Closure evalClosure(Evaluator top, xowl.lang.actions.ExecutableExpression expression) throws XOWLException;
    xowl.lang.runtime.Array evalArray(Evaluator top, xowl.lang.actions.ArrayExpression expression) throws XOWLException;
    xowl.lang.runtime.JavaObject evalJavaObject(Evaluator top, xowl.lang.interop.JavaObjectExpression expression) throws XOWLException;

    List<QuerySolution> select(Evaluator top, xowl.lang.actions.Select query) throws XOWLException;
    
    xowl.lang.runtime.Entity toEntity(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Class toClass(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.ObjectProperty toObjProp(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.DataProperty toDataProp(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Datatype toDatatype(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Individual toIndividual(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Literal toLiteral(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Function toFunction(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Closure toClosure(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.Array toArray(xowl.lang.runtime.Value value) throws XOWLException;
    xowl.lang.runtime.JavaObject toJavaObject(xowl.lang.runtime.Value value) throws XOWLException;
}
